package com.zw.mes.module.verifyprostatus.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.module.verifyprostatus.model.VerifyProStatusModel;
import com.zw.mes.module.verifyprostatus.service.VerifyProStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/verifyProStatus")
public class VerifyProStatusController  extends BaseController {
    @Autowired
    private VerifyProStatusService verifyProStatusService;

    @ResponseBody
    @PostMapping("/isDesignByProdNO")
    public JsonResult isDesignByProdNO(String prodNo)
    {
        VerifyProStatusModel verifyProStatusModel = verifyProStatusService.getVerifyProStatusModelByProdNo(prodNo);
        if(verifyProStatusModel.getDesignStatus()!=0)
        {
            return success("生产令："+prodNo+"归属于设计类项目，必须要填写部分，");
        }else
        {
            return error("生产令："+prodNo+"不属于设计类项目，不需要填写部分，");
        }
    }


    @ResponseBody
    @PostMapping("/isDesignByProCode")
    public JsonResult isDesignByProCode(String proCode)
    {
        VerifyProStatusModel verifyProStatusModel = verifyProStatusService.getVerifyProStatusModelByProCode(proCode);
        if(verifyProStatusModel.getDesignStatus()!=0)
        {
            return success("项目编号："+proCode+"归属于设计类项目，必须要填写部分，");
        }else
        {
            return error("项目编号："+proCode+"不属于设计类项目，不需要填写部分，");
        }
    }
}
